package com.ruoyi.model.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SNUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.ConstructDetailMapper;
import com.ruoyi.model.domain.ConstructDetail;
import com.ruoyi.model.service.IConstructDetailService;

/**
 * 建模数据明细Service业务层处理
 * 
 * @author WeiHanqiang
 * @date 2025-05-22
 */
@Service
public class ConstructDetailServiceImpl implements IConstructDetailService 
{
    @Autowired
    private ConstructDetailMapper constructDetailMapper;

    @Autowired
    private SNUtil snUtil;
    /**
     * 查询建模数据明细
     * 
     * @param constructDetailId 建模数据明细主键
     * @return 建模数据明细
     */
    @Override
    public ConstructDetail selectConstructDetailByConstructDetailId(Long constructDetailId)
    {
        return constructDetailMapper.selectConstructDetailByConstructDetailId(constructDetailId);
    }

    /**
     * 查询建模数据明细列表
     * 
     * @param constructDetail 建模数据明细
     * @return 建模数据明细
     */
    @Override
    public List<ConstructDetail> selectConstructDetailList(ConstructDetail constructDetail)
    {
        return constructDetailMapper.selectConstructDetailList(constructDetail);
    }

    /**
     * 新增建模数据明细
     * 
     * @param constructDetail 建模数据明细
     * @return 结果
     */
    @Override
    public int insertConstructDetail(ConstructDetail constructDetail)
    {
        String construct_data_detail_no = snUtil.generateSN("construct_detail", "construct_detail_no", "yyyyMMdd", "COND", 4);
        constructDetail.setConstructDetailNo(construct_data_detail_no);
        constructDetail.setCreateTime(DateUtils.getNowDate());
        return constructDetailMapper.insertConstructDetail(constructDetail);
    }

    /**
     * 修改建模数据明细
     * 
     * @param constructDetail 建模数据明细
     * @return 结果
     */
    @Override
    public int updateConstructDetail(ConstructDetail constructDetail)
    {
        return constructDetailMapper.updateConstructDetail(constructDetail);
    }

    /**
     * 根据建模数据id批量重置明细的数据划分及状态信息
     *
     * @param constructId 建模数据id
     * @return 结果
     */
    @Override
    public int resetConstructTypeAndStateByConstructId(Long constructId)
    {
        return constructDetailMapper.resetConstructTypeAndStateByConstructId(constructId);
    }

    /**
     * 根据建模数据id批量删除明细
     *
     * @param constructId 建模数据id
     * @return 结果
     */
    @Override
    public int deleteConstructDetailByConstructId(Long constructId)
    {
        return constructDetailMapper.deleteConstructDetailByConstructId(constructId);
    }

    /**
     * 批量删除建模数据明细
     * 
     * @param constructDetailIds 需要删除的建模数据明细主键
     * @return 结果
     */
    @Override
    public int deleteConstructDetailByConstructDetailIds(Long[] constructDetailIds)
    {
        return constructDetailMapper.deleteConstructDetailByConstructDetailIds(constructDetailIds);
    }

    /**
     * 删除建模数据明细信息
     * 
     * @param constructDetailId 建模数据明细主键
     * @return 结果
     */
    @Override
    public int deleteConstructDetailByConstructDetailId(Long constructDetailId)
    {
        return constructDetailMapper.deleteConstructDetailByConstructDetailId(constructDetailId);
    }
}
